package com.atguigu.srb.core.controller.api;

import com.atguigu.srb.common.result.Result;
import com.atguigu.srb.core.pojo.entity.Dict;
import com.atguigu.srb.core.service.DictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lsyandwh
 * @create 2022-12-14 16:09
 */
@Api(tags = "字典信息")
@RestController
@RequestMapping("/api/core/dict")
public class ApiDictController {

    @Autowired
    private DictService dictService;

    @ApiOperation("根据dictCode获取数据列表信息")
    @GetMapping("/getDictListByCode/{dictCode}")
    public Result getDictListByCode(@PathVariable String dictCode){

        List<Dict> list = dictService.getDictListByCode(dictCode);

        return Result.ok().data("list",list);
    }
}
